package com.atguigu.msmservice.utils;



import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Sire
 * @version 1.0
 * @date 2022-02-18 19:41
 */
@Component
public class ConstantPropertiesUtils implements InitializingBean {

    @Value("${tencentcloud.sms.appId}")
    private String appId;

    @Value("${tencentcloud.sms.appkey}")
    private String appkey;

    @Value("${tencentcloud.sms.secretKey}")
    private String secretKey;

    @Value("${tencentcloud.sms.secretId}")
    private String secretId;

    /**
     *  这里就不要调用propertis里的了，因为编码格式不一样，
     *   为啥其他的可以调用呢，因为其他的都是数字或者字母
     */

    @Value("爱喝水的攻城狮公众号")
    private String smsSign;

    @Value("${tencentcloud.sms.templateId}")
    private String templateId;

    @Value("${tencentcloud.sms.expireTime}")
    private String expireTime;

    public static String APP_ID;
    public static String APP_KEY;
    public static String SECRET_KEY;
    public static String SECRET_ID;
    public static String SMS_SIGN;
    public static String TEMPLATE_ID;
    public static String EXPIRE_TIME;

    @Override
    public void afterPropertiesSet() throws Exception {
        APP_ID = appId;
        APP_KEY = appkey;
        SECRET_KEY = secretKey;
        SECRET_ID = secretId;
        SMS_SIGN = smsSign;
        TEMPLATE_ID = templateId;
        EXPIRE_TIME = expireTime;
    }
}
